<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<html:html>
<head>
<META http-equiv=Pragma content=no-cache>
<META http-equiv=Cache-Control content=no-cache>
<META http-equiv=Expires content=0>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="../../style/css/style.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="../../style/scripts/util.js"  language="JavaScript"></script>
<script language="javascript1.2">
function callOrgTree(){
	var url = '<%=request.getContextPath()%>/pages/tree/treeList.jsp?formName=F0901UserActionForm&isBox=1&isRadio=1&className=Morg&treeName=管理机构树&isLeaf=0&backBm=MANAGORGID&backMc=MANAGORGNAME';
	callNewWindow(url,'_blank','430','350');
}

function operation1(){
	if(document.forms[0].chooseIP.checked == true){	
	 	window.document.forms[0].flag.value = true;
		var ip1 = window.document.forms[0].IP1.value;
		var ip2 = window.document.forms[0].IP2.value;
		var ip3 = window.document.forms[0].IP3.value;
		var ip4 = window.document.forms[0].IP4.value;
		var ip5 = window.document.forms[0].IP5.value;
		if(!ip(ip1)){return;}
		if(!ip(ip2)){return;}
		if(!ip(ip3)){return;}
		if(!ip(ip4)){return;}
		if(!ip(ip5)){return;}
	
		if( parseInt(ip4) > parseInt(ip5)){
			alert("IP输入范围不正确！");
			return;
		}
	}else{
		window.document.forms[0].flag.value = false;
	}

	if(validateActionForm(document.forms[0])){
		if(window.document.forms[0].PASSWORD.value != window.document.forms[0].CONPASSWORD.value){
			alert("两次密码输入不一致！");
			return;
		}
		
		window.document.forms[0].operationType.value = "submit";
		window.document.forms[0].submit();
	}
}
	
function ip(ip){
	if(!isAllDigits(ip)){
		alert("IP输入值应为数字！");
		return false;
	}
	if( parseInt(ip)<0 || parseInt(ip) >254){
		alert("IP输入值范围应为0至254！");
		return false;
	}
	return true;
}
	
function choose(){
	if(document.forms[0].chooseIP.checked == true){	
		document.all.tr1.style.display = "";
	 }else{
		document.all.tr1.style.display = "none";
	 }
}
function ShowFormTitle(strTitle){
	document.write("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"height:26px; background-position: left bottom; background-image: url(../../style/images/FormTitle_A_4.gif); background-repeat: repeat-x;\">");
	document.write("  <tr >");
	document.write("	<td style=\"width:5px; background-position: left bottom; background-image: url(../../style/images/FormTitle_A_1.gif); background-repeat: no-repeat;\">&nbsp;&nbsp;&nbsp;</td>");
	document.write("	<td class=\"FormTitle\" style=\"width:100%; padding-left:5px; padding-top:3px; background-position: left bottom; background-image: url(../../style/images/FormTitle_A_2.gif); background-repeat: no-repeat;\">");
	document.write("		<span id=\"spanFormTitle\" class=\"SpanTitle\">"+ strTitle +"</span>");
	document.write("	</td>");
	document.write("	<td style=\"width:5px; background-position: right bottom; background-image: url(../../style/images/FormTitle_A_3.gif); background-repeat: no-repeat;\">&nbsp;&nbsp;&nbsp;</td>");
    document.write("  </tr>");
	document.write("</table>");
}	
</script>
</head>

<body marginheight="0" marginwidth="0" bottommargin="0" topmargin="0">
<html:form method="post" action="/pages/F09/F0901RightUser.do" enctype="multipart/form-data">
<html:hidden property="operationType"/>
<html:hidden property="MANAGORGID"/>
<html:hidden property="flag"/>
<html:hidden property="ORGID"/>
<!--Begin：表单标题-->
<div class="DivBlock">
	<script language="javascript" type="text/javascript">
		ShowFormTitle("请输入用户信息");
	</script>
</div>
<!--End：表单标题-->
<!--Begin：表单折叠区块1-->
<div class="DivBlock">
<div class="DivWrap">
  <table  WIDTH="81%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
	<tr>
		<td width="12%" align="center">登&nbsp;&nbsp;录&nbsp;&nbsp;名</td>
		<td width="38%" ><html:text property="CODE" styleClass="MyText" maxlength="50" /></td>
		<td width="12%" align="center">用&nbsp;户&nbsp;名&nbsp;称</td>
		<td width="38%" ><html:text property="NAME" styleClass="MyText" maxlength="50" /></td>
	</tr>
	<tr>
		<td align="center">所&nbsp;属&nbsp;机&nbsp;构</td>
		<td colspan="3"><html:text property="ORGNAME" styleClass="MyText" maxlength="50"  readonly="true"/></td>
	</tr>
	<tr>
		<td align="center">用&nbsp;户&nbsp;密&nbsp;码</td>
		<td><html:password property="PASSWORD" styleClass="MyText" maxlength="50"/></td>
		<td align="center">确&nbsp;认&nbsp;密&nbsp;码</td>
		<td ><html:password property="CONPASSWORD" styleClass="MyText" maxlength="50"/></td>
	</tr>
	<tr>
		<td align="center">是否校验&nbsp;IP</td>
		<td colspan="3" nowrap="nowrap"><table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
			<tr>
				<td width="60" nowrap="nowrap"><input type="checkbox" checked="checked" name="chooseIP" OnClick="javascript:choose();"/>选择</td>
				<td width="95%" id="tr1" style="display:"><html:text property="IP1" styleClass="MyText" maxlength="3" size="6"/>
					<html:text property="IP2" styleClass="MyText" maxlength="3" size="6"/>
					<html:text property="IP3" styleClass="MyText" maxlength="3" size="6"/>
					<html:text property="IP4" styleClass="MyText" maxlength="3" size="6"/>&nbsp;
					至&nbsp;<html:text property="IP5" styleClass="MyText" maxlength="3" size="6"/>
				</td>
			</tr>
		</table></td>
	</tr>
	
	<tr>
		<td align="center">固&nbsp;定&nbsp;电&nbsp;话</td>
		<td><html:text property="TEL" styleClass="MyText" maxlength="50" /></td>
		<td align="center">移&nbsp;动&nbsp;电&nbsp;话</td>
		<td><html:text property="MOBIL" styleClass="MyText" maxlength="50"/></td>
	</tr>
	<tr>
		<td align="center">管&nbsp;理&nbsp;机&nbsp;构</td>
		<td colspan="3"><html:text property="MANAGORGNAME" styleClass="MyTextReadOnly" readonly="true" onclick="javascript:callOrgTree();"/></td>
	</tr>
	<tr>
		<td align="center">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注</td>
		<td colspan="3"><html:textarea property="NOTES" cols="62" rows="5" styleClass="MyArea"/></td>
	</tr>
  </table>
</div>
</div>
<!--End：表单折叠区块1-->
<div class="DivBlock">
<div class="DivButton">
  <input type="button" name="Submit1" class="MyButton" value="保存" onClick="javascript:operation1();">
  <input type="button" name="Submit1" class="MyButton" value="返回" onClick="javascript:operation('back');">
</div>
</div>
<html:messages id="aa" message="true"><bean:message key="errors.prefix"/><bean:write name="aa"/><bean:message key="errors.suffix"/></html:messages>
</html:form>
</body>
<logic:equal name="F0901UserActionForm" property="flag" value="false">
<script language="Javascript1.2" type="text/javascript">
document.forms[0].chooseIP.checked = false;
document.all.tr1.style.display = "none";
</script>
</logic:equal>
<script language="Javascript1.2" type="text/javascript">
	function validateActionForm(form) { 
		return validateMinLength(form)&&validateMaxLength(form)&&validateRequired(form);
	} 

    function minlength() { 
    	//this.aa = new Array("CODE", "代码 长度应为2位！", new Function ("varName", "this.minlength='2';  return this[varName];"));
    }  

	function maxlength(){
		this.aa = new Array("CODE", "登录名 长度大于20位！", new Function ("varName", "this.maxlength='20';  return this[varName];"));
		this.bb = new Array("NAME", "名称 长度大于10个汉字！", new Function ("varName", "this.maxlength='20';  return this[varName];"));
		this.cc = new Array("PASSWORD", "用户密码 长度大于30位！", new Function ("varName", "this.maxlength='30';  return this[varName];"));
		this.dd = new Array("NOTES", "备注 长度大于200个汉字！", new Function ("varName", "this.maxlength='400';  return this[varName];"));
		this.ee = new Array("TEL", "固定电话 长度大于50位！", new Function ("varName", "this.maxlength='50';  return this[varName];"));
		this.ff = new Array("MOBIL", "移动电话 长度大于50位！", new Function ("varName", "this.maxlength='50';  return this[varName];"));
		this.gg = new Array("MANAGORGNAME", "管理机构 长度大于4000位！", new Function ("varName", "this.maxlength='4000';  return this[varName];"));	
		this.hh = new Array("CONPASSWORD", "确认密码 长度大于30位！", new Function ("varName", "this.maxlength='30';  return this[varName];"));
	}
	
	function required(){
		this.aa = new Array("CODE", "登录名 不能为空！", new Function ("varName", "this.nullable='false';  return this[varName];"));
		this.bb = new Array("NAME", "用户名称 不能为空！", new Function ("varName", "this.nullable='false';  return this[varName];"));
		this.cc = new Array("PASSWORD", "用户密码 不能为空！", new Function ("varName", "this.nullable='false';  return this[varName];"));
		this.dd = new Array("ORGNAME", "所属机构 不能为空！", new Function ("varName", "this.nullable='false';  return this[varName];"));
		this.ee = new Array("CONPASSWORD", "确认密码 不能为空！", new Function ("varName", "this.nullable='false';  return this[varName];"));
		if(document.forms[0].chooseIP.checked == true){
			this.ff = new Array("IP1", "IP1 不能为空！", new Function ("varName", "this.nullable='false';  return this[varName];"));
			this.gg = new Array("IP2", "IP2 不能为空！", new Function ("varName", "this.nullable='false';  return this[varName];"));
			this.hh = new Array("IP3", "IP3 不能为空！", new Function ("varName", "this.nullable='false';  return this[varName];"));
			this.ii = new Array("IP4", "IP4 不能为空！", new Function ("varName", "this.nullable='false';  return this[varName];"));
			this.jj = new Array("IP5", "IP5 不能为空！", new Function ("varName", "this.nullable='false';  return this[varName];"));
		}
	}
</script>
</html:html>